package tr.gov.tubitak.bilgem.esya.certviewer.viwerasn;

import sun.security.util.ObjectIdentifier;
import tr.gov.tubitak.bilgem.esya.certviewer.Bundle;

import java.util.HashMap;

/**
 * Created by IntelliJ IDEA.
 * User: ramazan.girgin
 * Date: 12/6/11
 * Time: 10:15 AM
 * To change this template use File | Settings | File Templates.
 */
public class EAccessMethod {
    public EAccessMethod(ObjectIdentifier objectIdentifier) {
        this.objectIdentifier = objectIdentifier;
    }

    ObjectIdentifier objectIdentifier;

    @Override
    public String toString()
    {
        String objIdStr = objectIdentifier.toString();
        String retStr = objIdStr;
        if(authorityInfoAccessMethods.containsKey(objIdStr))
        {
            retStr= authorityInfoAccessMethods.get(objIdStr)+"("+objIdStr+")";
        }
        return retStr;
    }

    private static HashMap<String, String> authorityInfoAccessMethods = null;
    static{
        authorityInfoAccessMethods = new HashMap<String, String>(4);
        authorityInfoAccessMethods.put("1.3.6.1.5.5.7.48.1", Bundle.getString("EAccessMethod.ocsp"));
        authorityInfoAccessMethods.put("1.3.6.1.5.5.7.48.2",Bundle.getString("EAccessMethod.certAuthorityIssuer"));
        authorityInfoAccessMethods.put("1.3.6.1.5.5.7.48.3",Bundle.getString("EAccessMethod.timeStamp"));
        authorityInfoAccessMethods.put("1.3.6.1.5.5.7.48.4",Bundle.getString("EAccessMethod.dvcs"));
    }
}
